package com.cn.wanxi.service.impl;

import com.cn.wanxi.dao.CompanyDao;
import com.cn.wanxi.dao.impl.CompanyImpl;
import com.cn.wanxi.model.CompanyModel;
import com.cn.wanxi.model.ResultModel;
import com.cn.wanxi.service.CompanyService;

public class CompanyServiceImpl implements CompanyService {
    private CompanyDao companyDao = new CompanyImpl();

    @Override
    public ResultModel add(CompanyModel companyModel) {
        return new ResultModel(companyDao.add(companyModel) > 0 ? ResultModel.SUCCESS : ResultModel.ERROR);
    }

    @Override
    public ResultModel update(CompanyModel companyModel) {
        return new ResultModel(companyDao.update(companyModel) > 0 ? ResultModel.SUCCESS : ResultModel.ERROR);
    }

    @Override
    public ResultModel delete(CompanyModel companyModel) {
        return new ResultModel(companyDao.delete(companyModel) > 0 ? ResultModel.SUCCESS : ResultModel.ERROR);
    }

    @Override
    public ResultModel findById(CompanyModel companyModel) {
        return new ResultModel(companyDao.findById(companyModel));
    }

    @Override
    public ResultModel findAll(CompanyModel companyModel) {
        return new ResultModel(companyDao.findAll(companyModel));
    }

    @Override
    public ResultModel getCount(CompanyModel companyModel) {
        return new ResultModel(companyDao.getCount(companyModel));
    }
}
